package tables

import (
	"peilian-api/app/global/variable"

	"gorm.io/gorm"
)

type FeedBack struct {
	gorm.Model
	Type    uint   `gorm:"type:tinyint(1);not null;comment:类型,1:问题,2:意见,3:其他"`
	UserId  uint   `gorm:"type:uint;not null;comment:用户id"`
	Content string `gorm:"type:varchar(2048);comment:意见反馈内容"`
	Images  string `gorm:"type:varchar(64);comment:图片id"`
	Videos  string `gorm:"type:varchar(64);comment:视频id"`
}

func (FeedBack) TableName() string {
	return "feedback"
}

func (f *FeedBack) InsertFeedBack(fbk FeedBack) error {
	if d := variable.DB.MySQL.Model(f).Save(&fbk); d.Error != nil {
		return d.Error
	}
	return nil
}
